/**
 * 信息相关接口
 */

import base from '@/common/base'; // 导入接口域名列表
import axios from '@/common/http'; // 导入http中创建的axios实例
import qs from 'qs'; // 根据需求是否导入qs模块

const index = {
    // 文章详情
    detail(id) {
        return axios({
            method: 'get',
            url: `${base.sq}Message/details`,
            params: {id: id},
            headers: {'user': 1}
        });
    },

    // 文章列表
    lists(id, page, pageCount = 0, key = '') {

        return axios({
            method: 'get',
            url: `${base.sq}Message/articleList`,
            params: {cat: id, page: page, pageCount: pageCount, keyword: key},
            headers: {'user': 1}
        });
    },

    //降价通知
    getCutPrice(page = 1) {
        return axios({
            method: 'get',
            url: `${base.sq}Message/getCutPrice`,
            params: {page: page}
        });
    },

    getMessage(page) {
        return axios({
            method: 'get',
            url: `${base.sq}Message/getMessage`,
            params: {page: page},
            headers: {'load': 1}
        });
    },

    //文章留言
    sendArticleMsg(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Message/sendArticleMsg`,
            data: qs.stringify(params)
        });
    },

    //文章收藏
    articleCollect(params){
        return axios({
            method: 'post',
            url: `${base.sq}Message/articleCollect`,
            data: qs.stringify(params),
            headers:{'load':1}
        });
    },

    //文章收藏
    artGood(params){
        return axios({
            method: 'post',
            url: `${base.sq}Message/articleGood`,
            data: qs.stringify(params),
            headers:{'load':1}
        });
    },

    // 留言列表
    getMsg(id,page) {
        return axios({
            method: 'get',
            url: `${base.sq}Message/getMessageList`,
            params: {id: id,page:page},
            headers: {'user': 1}
        });
    },

    // 留言点赞
    artMsgGood(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Message/goodMsg`,
            data:qs.stringify(params),
            headers:{'user':1}
        });
    },

}

export default index;
